package cn.kkcxy.blog.core.enums;

import lombok.Getter;

/**
 * @BelongsProject: kkcxy-blog
 * @BelongsPackage: cn.kkcxy.blog.core.enums
 * @Author: kkcxy
 * @CreateTime: 2024-09-11 23:42
 * @Description: 登录类型枚举
 * @Version: 1.0
 */
@Getter
public enum LoginTypeEnum {

    ACCOUNT(1, "账号"),
    EMAIL(2, "邮箱"),
    PHONE(3, "手机"),
    WECHAT(4, "微信");

    public final int type;

    public final String name;

    LoginTypeEnum(Integer type, String name) {
        this.type = type;
        this.name = name;
    }

    public static LoginTypeEnum getType(int typeCode) {
        for (LoginTypeEnum typeEnum : LoginTypeEnum.values()) {
            if (typeEnum.type == typeCode) {
                return typeEnum;
            }
        }
        return null;
    }
}
